<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<title>Get The Mouse Position</title>  
</head>  
<body>  
<!--************************************* Demo Start *************************************-->  
<script type="text/javascript">
function mousePosition(ev)  
{  
    if(ev.pageX || ev.pageY){return {x:ev.pageX, y:ev.pageY};}  
    return {x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop};   
}  
  
document.onmousemove = mouseMove;  
  
function mouseMove(ev)  
{  
    evev = ev || window.event;  
    var mousePos = mousePosition(ev);  
    document.getElementById('mouseXPosition').value = mousePos.x;  
    document.getElementById('mouseYPosition').value = mousePos.y;  
}  
</script>
  
<fieldset>  
    <legend>Demo - Move Your Mouse Please</legend>  
    X:<input id=mouseXPosition><br />     
    Y:<input id=mouseYPosition>   
</fieldset>  
<!--************************************* Demo End *************************************-->  
</body>  
</html>